varying vec3 N, L;

void main()
{
	const float specularExp = 256.0;
	vec3 NN = normalize(N);
	vec3 lightCol;
	lightCol = vec3(0.5,0.5,1.2);
	
  gl_FragColor=0.5 * gl_Color;

	vec3 NL = normalize( L );
	vec3 NH = normalize( NL +vec3(0.0,0.0,1.0) );
	float NdotL = max(0.0,dot(NN,NL));
	gl_FragColor.rgb += 1.0  * gl_Color.rgb *lightCol *NdotL;
	
  gl_FragColor.rgb=clamp(gl_FragColor.rgb, 0.0, gl_Color.rgb);

	if( NdotL > 0.0 )
		gl_FragColor.rgb += 0.4 * lightCol * pow(max(0.0,dot(NN,NH)),specularExp);
  
  
  //gl_FragColor=gl_Color;
  //gl_FragColor=vec4(NdotL);
  

/*
  if (NdotL > 0.95)
		gl_FragColor = 1.1 *gl_Color;
	else if (NdotL > 0.5)
		gl_FragColor = 1.0 * gl_Color;
	else if (NdotL > 0.25)
		gl_FragColor = 0.7 * gl_Color;
	else
		gl_FragColor = 0.7 * gl_Color;
*/


  gl_FragColor.a = 1.0;
}


